/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Beans;

import AppServices.CountryCityManage;
import AppServices.LocationManage;
import AppServices.ReserveManage;
import AppServices.UsersManage;
import VOs.City;
import VOs.Country;
import VOs.Location;
import VOs.Reserve;
import VOs.Users;
import java.util.Date;
import javax.ejb.Stateless;
import AppServices.EnterpriseManage;
import AppServices.PlanManage;
import VOs.Enterprise;
import VOs.Plan;
import java.util.List;

/**
 *
 * @author Julian
 */
@Stateless
public class LogicaBean implements LogicaRemote {

    public boolean checklogin(String username, String pass) throws Exception {
        return UsersManage.checklogin(username, pass);
    }

    public boolean checkAdminLogin(String username, String pass){
        return UsersManage.checkAdminLogin(username, pass);
    }

    public boolean createUsers(String username, String name, String lastname, String phone, String pass, String creditcard, String email,String identification) throws Exception {
        return UsersManage.createUsers(username, name, lastname, phone, pass, creditcard, email, identification);
    }

    public boolean editUsers(String username, String name, String lastname, String phone, String pass, String creditcard, String email) throws Exception {
        return UsersManage.editUsers(username, name, lastname, phone, pass, creditcard, email);
    }

    public List<City> findbyCountry(String Country) throws Exception {
        return CountryCityManage.findbyCountry(Country);
    }

    public List<Country> findallCountries() throws Exception {
        return CountryCityManage.findall();
    }

    public boolean createReserve(int idplan, int idslocation, Date inicio, Date fin, String idext) throws Exception {
        return ReserveManage.createReserve(idplan, idslocation, inicio, fin, idext);
    }

    public boolean editReserve(int idplan, int idslocation, Date inicio, Date fin, String idext) throws Exception {
        return ReserveManage.editReserve(idplan, idslocation, inicio, fin, idext);
    }

    public List<Reserve> findByPlan(int id) throws Exception {
        return ReserveManage.findByPlan(id);
    }

    public boolean createLocation(String Address, int City, String Enterprise) throws Exception {
        return LocationManage.createLocation(Address, City, Enterprise);
    }

    public boolean editLocation(int ID, String Address, int City) throws Exception {
        return LocationManage.editLocation(ID, Address, City);
    }

    public List<Location> getLocation(String Enterprise) throws Exception{
    return LocationManage.getLocation(Enterprise);
    }

    public int TotalByPlan(int id) throws Exception {
        return ReserveManage.TotalByPlan(id);
    }

    public boolean editEnterprise(String idEnterprise, String newUrl, String newPhone, String newIdType) {
        return EnterpriseManage.editEnterprise(idEnterprise, newUrl, newPhone, newIdType);
    }

    public Enterprise getEnterpriseById(String referenceId) throws Exception {
        return EnterpriseManage.getById(referenceId);
    }

    public List<Enterprise> getEnterpriseByType(String referenceIdType, int codePage, int pageLength) throws Exception {
        return EnterpriseManage.getByType(referenceIdType, codePage, pageLength);
    }

    public boolean createPlan(String userName) {
        return PlanManage.createPlan(userName);
    }

    public List<Plan> getPlanByUsername(String userName, int pageCode, int pageLength) {
        return PlanManage.getByUsername(userName, pageCode, pageLength);
    }

    public boolean cancelReserve(int idreserva) throws Exception {
        return ReserveManage.cancelReserve(idreserva);
    }

    public List<Location> getLocationCity (int idCity) throws Exception{
    return LocationManage.getLocationCity(idCity);
    }

    public List<Location> getLocationByTipeEnterprise(String idTipe) throws Exception{
    return LocationManage.getLocationByTipeEnterprise(idTipe);
    }

    public List<City> findallCity() throws Exception {
        return CountryCityManage.findallCity();
    }

    public List<Plan> getPlansWithActiveReservesByUsername(String userName) throws Exception {
        return PlanManage.getPlansWithActiveReservesByUsername(userName);
    }

    public Users User(String username) throws Exception {
        return UsersManage.User(username);
    }


    public Plan createPlan2(String userName) {
        return PlanManage.createPlan2(userName);
    }


    public List<Plan> getall(String user) throws Exception {
        return PlanManage.getall(user);
    }


   
}
